package com.unf.edu.rms.controller.validation;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.unf.edu.rms.controller.userlogin.UserLoginController;
import com.unf.edu.rms.dao.UserLogin;

public class UserLoginValidator implements Validator{

	@Override
	public boolean supports(Class<?> arg0) {
		return UserLoginController.class.equals(arg0);
		
	}

	@Override
	public void validate(Object obj, Errors errors) {
		System.out.println("UserLoginValidator.validate()==============");
		UserLogin userLogin = (UserLogin)obj;
		ValidationUtils.rejectIfEmpty(errors, "userName", "error.username.required");
		ValidationUtils.rejectIfEmpty(errors, "password", "error.password.required");	
	}

}
